#include <stdio.h>
#include <string.h>
//逆序字符串，字符串长度1~100
//例子，输入：I like beijing. 输出：beijing. like I

void reverse(char* left, char* right)
{
    char tmp = 0;
    while(left<right)
    {   
        tmp = *left;
        *left = *right;
        *right = tmp;
        left++;
        right--;
    }
}

int main(){
    char arr[101] = {0};
    gets(arr);
    int len = strlen(arr);
    //1.逆序字符串
    char* left = arr;
    char* right = arr+len-1;
    reverse(left,right);

    //2.逆序其中每一个单词
    char* start = arr;
    char* end = start;
    while(*start)
    {
        if(*end != ' ' && *end != '\0')
        {
        end++;
        }
        else
        {
        reverse(start,end-1);
        end++;
        start = end;
        }
    }
    //输出
    printf("%s\n", arr);
    return 0;
}